.\" Man page generated from reStructuredText.
.
.TH "KNIFE-NODE" "1" "Chef 12.0" "" "knife node"
.SH NAME
knife-node \- The man page for the knife node subcommand.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.sp
A node is any physical, virtual, or cloud machine that is configured to be maintained by a chef\-client\&.
.sp
The \fBknife node\fP subcommand is used to manage the nodes that exist on a Chef server\&.
.SH COMMON OPTIONS
.sp
The following options may be used with any of the arguments available to the \fBknife node\fP subcommand:
.INDENT 0.0
.TP
.B \fB\-\-chef\-zero\-port PORT\fP
The port on which chef\-zero will listen.
.TP
.B \fB\-c CONFIG_FILE\fP, \fB\-\-config CONFIG_FILE\fP
The configuration file to use.
.TP
.B \fB\-d\fP, \fB\-\-disable\-editing\fP
Use to prevent the $EDITOR from being opened and to accept data as\-is.
.TP
.B \fB\-\-defaults\fP
Use to have knife use the default value instead of asking a user to provide one.
.TP
.B \fB\-e EDITOR\fP, \fB\-\-editor EDITOR\fP
The $EDITOR that is used for all interactive commands.
.TP
.B \fB\-E ENVIRONMENT\fP, \fB\-\-environment ENVIRONMENT\fP
The name of the environment. When this option is added to a command, the command will run only against the named environment.
.TP
.B \fB\-F FORMAT\fP, \fB\-\-format FORMAT\fP
The output format: \fBsummary\fP (default), \fBtext\fP, \fBjson\fP, \fByaml\fP, and \fBpp\fP\&.
.TP
.B \fB\-h\fP, \fB\-\-help\fP
Shows help for the command.
.TP
.B \fB\-k KEY\fP, \fB\-\-key KEY\fP
The private key that knife will use to sign requests made by the API client to the Chef server\&.
.TP
.B \fB\-\-[no\-]color\fP
Use to view colored output.
.TP
.B \fB\-\-print\-after\fP
Use to show data after a destructive operation.
.TP
.B \fB\-s URL\fP, \fB\-\-server\-url URL\fP
The URL for the Chef server\&.
.TP
.B \fB\-u USER\fP, \fB\-\-user USER\fP
The user name used by knife to sign requests made by the API client to the Chef server\&. Authentication will fail if the user name does not match the private key.
.TP
.B \fB\-V\fP, \fB\-\-verbose\fP
Set for more verbose outputs. Use \fB\-VV\fP for maximum verbosity.
.TP
.B \fB\-v\fP, \fB\-\-version\fP
The version of the chef\-client\&.
.TP
.B \fB\-y\fP, \fB\-\-yes\fP
Use to respond to all confirmation prompts with "Yes". knife will not ask for confirmation.
.TP
.B \fB\-z\fP, \fB\-\-local\-mode\fP
Use to run the chef\-client in local mode. This allows all commands that work against the Chef server to also work against the local chef\-repo\&.
.UNINDENT
.SH BULK DELETE
.sp
The \fBbulk delete\fP argument is used to delete one or more nodes that match a pattern defined by a regular expression. The regular expression must be within quotes and not be surrounded by forward slashes (/).
.sp
\fBSyntax\fP
.sp
This argument has the following syntax:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node bulk delete REGEX
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
\fBOptions\fP
.sp
This command does not have any specific options.
.sp
\fBExamples\fP
.sp
Use a regular expression to define the pattern used to bulk delete nodes:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node bulk delete "^[0\-9]{3}$"
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Type \fBY\fP to confirm a deletion.
.SH CREATE
.sp
The \fBcreate\fP argument is used to add a node to the Chef server\&. Node data is stored as JSON on the Chef server\&.
.sp
\fBSyntax\fP
.sp
This argument has the following syntax:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node create NODE_NAME
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
\fBOptions\fP
.sp
This command does not have any specific options.
.sp
\fBExamples\fP
.sp
To add a node, enter:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node create node1
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
In the $EDITOR enter the node data in JSON:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
## sample:
{
   "normal": {
   },
   "name": "foobar",
   "override": {
   },
   "default": {
   },
   "json_class": "Chef::Node",
   "automatic": {
   },
   "run_list": [
      "recipe[zsh]",
      "role[webserver]"
   ],
   "chef_type": "node"
}
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
When finished, save it.
.SH DELETE
.sp
The \fBdelete\fP argument is used to delete a node from the Chef server\&.
.sp
\fBNOTE:\fP
.INDENT 0.0
.INDENT 3.5
Deleting a node will not delete any corresponding API clients.
.UNINDENT
.UNINDENT
.sp
\fBSyntax\fP
.sp
This argument has the following syntax:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node delete NODE_NAME
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
\fBOptions\fP
.sp
This command does not have any specific options.
.sp
\fBExamples\fP
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node delete node_name
.ft P
.fi
.UNINDENT
.UNINDENT
.SH EDIT
.sp
The \fBedit\fP argument is used to edit the details of a node on a Chef server\&. Node data is stored as JSON on the Chef server\&.
.sp
\fBSyntax\fP
.sp
This argument has the following syntax:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node edit NODE_NAME (options)
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
\fBOptions\fP
.sp
This argument has the following options:
.INDENT 0.0
.TP
.B \fB\-a\fP, \fB\-\-all\fP
Displays a node in the $EDITOR\&. By default, attributes that are default, override, or automatic are not shown.
.UNINDENT
.sp
\fBExamples\fP
.sp
To edit the data for a node named \fBnode1\fP, enter:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node edit node1 \-a
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Update the role data in JSON:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
## sample:
{
   "normal": {
   },
   "name": "node1",
   "override": {
   },
   "default": {
   },
   "json_class": "Chef::Node",
   "automatic": {
   },
   "run_list": [
      "recipe[devops]",
      "role[webserver]"
   ],
   "chef_type": "node"
}
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
When finished, save it.
.SH FROM FILE
.sp
The \fBfrom file\fP argument is used to create a node using existing node data as a template.
.sp
\fBSyntax\fP
.sp
This argument has the following syntax:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node from file FILE
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
\fBOptions\fP
.sp
This command does not have any specific options.
.sp
\fBExamples\fP
.sp
To add a node using data contained in a JSON file:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node from file "path to JSON file"
.ft P
.fi
.UNINDENT
.UNINDENT
.SH LIST
.sp
The \fBlist\fP argument is used to view all of the nodes that exist on a Chef server\&.
.sp
\fBSyntax\fP
.sp
This argument has the following syntax:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node list (options)
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
\fBOptions\fP
.sp
This argument has the following options:
.INDENT 0.0
.TP
.B \fB\-w\fP, \fB\-\-with\-uri\fP
Use to show the corresponding URIs.
.UNINDENT
.sp
\fBExamples\fP
.sp
To verify the list of nodes that are registered with the Chef server, enter:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node list
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
to return something similar to:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
i\-12345678
rs\-123456
.ft P
.fi
.UNINDENT
.UNINDENT
.SH RUN_LIST ADD
.sp
The \fBrun_list add\fP argument is used to add run\-list items (roles or recipes) to a node.
.sp
\fBSyntax\fP
.sp
This argument has the following syntax:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node run_list add NODE_NAME RUN_LIST_ITEM (options)
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
\fBOptions\fP
.sp
This argument has the following options:
.INDENT 0.0
.TP
.B \fB\-a ITEM\fP, \fB\-\-after ITEM\fP
Use this to add the run list item after the specified run list item.
.TP
.B \fB\-b ITEM\fP, \fB\-\-before ITEM\fP
Use this to add the run list item before the specified run list item.
.UNINDENT
.sp
\fBExamples\fP
.sp
To add a role to a run\-list, enter:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node run_list add node \(aqrole[ROLE_NAME]\(aq
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To add roles and recipes to a run\-list, enter:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node run_list add node \(aqrecipe[COOKBOOK::RECIPE_NAME],recipe[COOKBOOK::RECIPE_NAME],role[ROLE_NAME]\(aq
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To add a recipe to a run\-list using the fully qualified format, enter:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node run_list add node \(aqrecipe[COOKBOOK::RECIPE_NAME]\(aq
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To add a recipe to a run\-list using the cookbook format, enter:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node run_list add node \(aqCOOKBOOK::RECIPE_NAME\(aq
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To add the default recipe of a cookbook to a run\-list, enter:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node run_list add node \(aqCOOKBOOK\(aq
.ft P
.fi
.UNINDENT
.UNINDENT
.SH RUN_LIST REMOVE
.sp
The \fBrun_list remove\fP argument is used to remove run\-list items (roles or recipes) from a node. A recipe must be in one of the following formats: fully qualified, cookbook, or default. Both roles and recipes must be in quotes, for example: \fB\(aqrole[ROLE_NAME]\(aq\fP or \fB\(aqrecipe[COOKBOOK::RECIPE_NAME]\(aq\fP\&. Use a comma to separate roles and recipes when removing more than one, like this: \fB\(aqrecipe[COOKBOOK::RECIPE_NAME],COOKBOOK::RECIPE_NAME,role[ROLE_NAME]\(aq\fP\&.
.sp
\fBSyntax\fP
.sp
This argument has the following syntax:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node run_list remove NODE_NAME RUN_LIST_ITEM
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
\fBOptions\fP
.sp
This command does not have any specific options.
.sp
\fBExamples\fP
.sp
To remove a role from a run\-list, enter:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node run_list remove node \(aqrole[ROLE_NAME]\(aq
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To remove a recipe from a run\-list using the fully qualified format, enter:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node run_list remove node \(aqrecipe[COOKBOOK::RECIPE_NAME]\(aq
.ft P
.fi
.UNINDENT
.UNINDENT
.SH SHOW
.sp
The \fBshow\fP argument is used to display information about a node.
.sp
\fBSyntax\fP
.sp
This argument has the following syntax:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node show NODE_NAME (options)
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
\fBOptions\fP
.sp
This argument has the following options:
.INDENT 0.0
.TP
.B \fB\-a ATTR\fP, \fB\-\-attribute ATTR\fP
The attribute (or attributes) to show.
.TP
.B \fB\-l\fP, \fB\-\-long\fP
Use to display all attributes in the output and to show the output as JSON\&.
.TP
.B \fB\-m\fP, \fB\-\-medium\fP
Use to display normal attributes in the output and to show the output as JSON\&.
.TP
.B \fB\-r\fP, \fB\-\-run\-list\fP
Use to show only the run\-list.
.UNINDENT
.sp
\fBExamples\fP
.sp
To view all data for a node named \fBbuild\fP, enter:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node show build
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
to return:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
Node Name:   build
Environment: _default
FQDN:
IP:
Run List:
Roles:
Recipes:
Platform:
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To show basic information about a node, truncated and nicely formatted:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
knife node show <node_name>
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To show all information about a node, nicely formatted:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
knife node show \-l <node_name>
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To list a single node attribute:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
knife node show <node_name> \-a <attribute_name>
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
where \fB<attribute_name>\fP is something like kernel or platform. (This doesn\(aqt work for nested attributes like \fBnode[kernel][machine]\fP because \fBknife node show\fP doesn\(aqt understand nested attributes.)
.sp
To view the FQDN for a node named \fBi\-12345678\fP, enter:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node show i\-12345678 \-a fqdn
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
to return:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
fqdn: ip\-10\-251\-75\-20.ec2.internal
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To view the run list for a node named \fBdev\fP, enter:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife node show dev \-r
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To view information in JSON format, use the \fB\-F\fP common option as part of the command like this:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ knife role show devops \-F json
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Other formats available include \fBtext\fP, \fByaml\fP, and \fBpp\fP\&.
.sp
To view node information in raw JSON, use the \fB\-l\fP or \fB\-\-long\fP option:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
knife node show \-l \-F json <node_name>
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
and/or:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
knife node show \-l \-\-format=json <node_name>
.ft P
.fi
.UNINDENT
.UNINDENT
.SH AUTHOR
Chef
.\" Generated by docutils manpage writer.
.
